home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / content / nsIImageLoadingContent.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  12KB  |  310 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIImageLoadingContent.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIImageLoadingContent_h__
  6. #define __gen_nsIImageLoadingContent_h__
  7.  
  8.  
  9. #ifndef __gen_imgIDecoderObserver_h__
  10. #include "imgIDecoderObserver.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class imgIRequest; /* forward declaration */
  18.  
  19. class nsIChannel; /* forward declaration */
  20.  
  21. class nsIStreamListener; /* forward declaration */
  22.  
  23. class nsIURI; /* forward declaration */
  24.  
  25.  
  26. /* starting interface:    nsIImageLoadingContent */
  27. #define NS_IIMAGELOADINGCONTENT_IID_STR "da19c86d-08aa-421c-8c37-12ec2ba5a2c3"
  28.  
  29. #define NS_IIMAGELOADINGCONTENT_IID \
  30.   {0xda19c86d, 0x08aa, 0x421c, \
  31.     { 0x8c, 0x37, 0x12, 0xec, 0x2b, 0xa5, 0xa2, 0xc3 }}
  32.  
  33. /**
  34.  * This interface represents a content node that loads images.  The interface
  35.  * exists to allow getting information on the images that the content node
  36.  * loads and to allow registration of observers for the image loads.
  37.  *
  38.  * Implementors of this interface should handle all the mechanics of actually
  39.  * loading an image -- getting the URI, checking with content policies and
  40.  * the security manager to see whether loading the URI is allowed, performing
  41.  * the load, firing any DOM events as needed.
  42.  *
  43.  * An implementation of this interface may support the concepts of a
  44.  * "current" image and a "pending" image.  If it does, a request to change
  45.  * the currently loaded image will start a "pending" request which will
  46.  * become current only when the image is loaded.  It is the responsibility of
  47.  * observers to check which request they are getting notifications for.
  48.  *
  49.  * Observers added in mid-load will not get any notifications they
  50.  * missed.  We should NOT freeze this interface without considering
  51.  * this issue.  (It could be that the image status on imgIRequest is
  52.  * sufficient, when combined with the imageBlockingStatus information.)
  53.  *
  54.  * XXXbz Do not freeze without removing imageURIChanged!
  55.  */
  56. class NS_NO_VTABLE nsIImageLoadingContent : public imgIDecoderObserver {
  57.  public: 
  58.  
  59.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IIMAGELOADINGCONTENT_IID)
  60.  
  61.   /**
  62.    * Request types.  Image loading content nodes attempt to do atomic
  63.    * image changes when the image url is changed.  This means that
  64.    * when the url changes the new image load will start, but the old
  65.    * image will remain the "current" request until the new image is
  66.    * fully loaded.  At that point, the old "current" request will be
  67.    * discarded and the "pending" request will become "current".
  68.    */
  69.   enum { UNKNOWN_REQUEST = -1 };
  70.  
  71.   enum { CURRENT_REQUEST = 0 };
  72.  
  73.   enum { PENDING_REQUEST = 1 };
  74.  
  75.   /**
  76.    * loadingEnabled is used to enable and disable loading in
  77.    * situations where loading images is unwanted.  Note that enabling
  78.    * loading will *not* automatically trigger an image load.
  79.    */
  80.   /* attribute boolean loadingEnabled; */
  81.   NS_IMETHOD GetLoadingEnabled(PRBool *aLoadingEnabled) = 0;
  82.   NS_IMETHOD SetLoadingEnabled(PRBool aLoadingEnabled) = 0;
  83.  
  84.   /**
  85.    * Returns the image blocking status (@see nsIContentPolicy).  This
  86.    * will always be an nsIContentPolicy REJECT_* status for cases when
  87.    * the image was blocked.  This status always refers to the
  88.    * CURRENT_REQUEST load.
  89.    */
  90.   /* readonly attribute short imageBlockingStatus; */
  91.   NS_IMETHOD GetImageBlockingStatus(PRInt16 *aImageBlockingStatus) = 0;
  92.  
  93.   /**
  94.    * Used to register an image decoder observer.  Typically, this will
  95.    * be a proxy for a frame that wants to paint the image.
  96.    * Notifications from ongoing image loads will be passed to all
  97.    * registered observers.  Notifications for all request types,
  98.    * current and pending, will be passed through.
  99.    *
  100.    * @param aObserver the observer to register
  101.    *
  102.    * @throws NS_ERROR_OUT_OF_MEMORY
  103.    */
  104.   /* void addObserver (in imgIDecoderObserver aObserver); */
  105.   NS_IMETHOD AddObserver(imgIDecoderObserver *aObserver) = 0;
  106.  
  107.   /**
  108.    * Used to unregister an image decoder observer.
  109.    *
  110.    * @param aObserver the observer to unregister
  111.    */
  112.   /* void removeObserver (in imgIDecoderObserver aObserver); */
  113.   NS_IMETHOD RemoveObserver(imgIDecoderObserver *aObserver) = 0;
  114.  
  115.   /**
  116.    * Accessor to get the image requests
  117.    *
  118.    * @param aRequestType a value saying which request is wanted
  119.    *
  120.    * @return the imgIRequest object (may be null, even when no error
  121.    * is thrown)
  122.    *
  123.    * @throws NS_ERROR_UNEXPECTED if the request type requested is not
  124.    * known
  125.    */
  126.   /* imgIRequest getRequest (in long aRequestType); */
  127.   NS_IMETHOD GetRequest(PRInt32 aRequestType, imgIRequest **_retval) = 0;
  128.  
  129.   /**
  130.    * Used to find out what type of request one is dealing with (eg
  131.    * which request got passed through to the imgIDecoderObserver
  132.    * interface of an observer)
  133.    *
  134.    * @param aRequest the request whose type we want to know
  135.    *
  136.    * @return an enum value saying what type this request is
  137.    *
  138.    * @throws NS_ERROR_UNEXPECTED if aRequest is not known
  139.    */
  140.   /* long getRequestType (in imgIRequest aRequest); */
  141.   NS_IMETHOD GetRequestType(imgIRequest *aRequest, PRInt32 *_retval) = 0;
  142.  
  143.   /**
  144.    * Gets the URI of the current request, if available.
  145.    * Otherwise, returns the last URI that this content tried to load, or
  146.    * null if there haven't been any such attempts.
  147.    */
  148.   /* readonly attribute nsIURI currentURI; */
  149.   NS_IMETHOD GetCurrentURI(nsIURI * *aCurrentURI) = 0;
  150.  
  151.   /**
  152.    * loadImageWithChannel allows data from an existing channel to be
  153.    * used as the image data for this content node.
  154.    *
  155.    * @param aChannel the channel that will deliver the data
  156.    *
  157.    * @return a stream listener to pump the image data into
  158.    *
  159.    * @see imgILoader::loadImageWithChannel
  160.    *
  161.    * @throws NS_ERROR_NULL_POINTER if aChannel is null
  162.    */
  163.   /* nsIStreamListener loadImageWithChannel (in nsIChannel aChannel); */
  164.   NS_IMETHOD LoadImageWithChannel(nsIChannel *aChannel, nsIStreamListener **_retval) = 0;
  165.  
  166.   /**
  167.    * ImageURIChanged is called when the appropriate attributes (eg
  168.    * 'src' for <img> tags) change.  The string passed in is the new
  169.    * uri string.
  170.    */
  171.   /* [noscript] void imageURIChanged (in AString aNewURI); */
  172.   NS_IMETHOD ImageURIChanged(const nsAString & aNewURI) = 0;
  173.  
  174. };
  175.  
  176. /* Use this macro when declaring classes that implement this interface. */
  177. #define NS_DECL_NSIIMAGELOADINGCONTENT \
  178.   NS_IMETHOD GetLoadingEnabled(PRBool *aLoadingEnabled); \
  179.   NS_IMETHOD SetLoadingEnabled(PRBool aLoadingEnabled); \
  180.   NS_IMETHOD GetImageBlockingStatus(PRInt16 *aImageBlockingStatus); \
  181.   NS_IMETHOD AddObserver(imgIDecoderObserver *aObserver); \
  182.   NS_IMETHOD RemoveObserver(imgIDecoderObserver *aObserver); \
  183.   NS_IMETHOD GetRequest(PRInt32 aRequestType, imgIRequest **_retval); \
  184.   NS_IMETHOD GetRequestType(imgIRequest *aRequest, PRInt32 *_retval); \
  185.   NS_IMETHOD GetCurrentURI(nsIURI * *aCurrentURI); \
  186.   NS_IMETHOD LoadImageWithChannel(nsIChannel *aChannel, nsIStreamListener **_retval); \
  187.   NS_IMETHOD ImageURIChanged(const nsAString & aNewURI); 
  188.  
  189. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  190. #define NS_FORWARD_NSIIMAGELOADINGCONTENT(_to) \
  191.   NS_IMETHOD GetLoadingEnabled(PRBool *aLoadingEnabled) { return _to GetLoadingEnabled(aLoadingEnabled); } \
  192.   NS_IMETHOD SetLoadingEnabled(PRBool aLoadingEnabled) { return _to SetLoadingEnabled(aLoadingEnabled); } \
  193.   NS_IMETHOD GetImageBlockingStatus(PRInt16 *aImageBlockingStatus) { return _to GetImageBlockingStatus(aImageBlockingStatus); } \
  194.   NS_IMETHOD AddObserver(imgIDecoderObserver *aObserver) { return _to AddObserver(aObserver); } \
  195.   NS_IMETHOD RemoveObserver(imgIDecoderObserver *aObserver) { return _to RemoveObserver(aObserver); } \
  196.   NS_IMETHOD GetRequest(PRInt32 aRequestType, imgIRequest **_retval) { return _to GetRequest(aRequestType, _retval); } \
  197.   NS_IMETHOD GetRequestType(imgIRequest *aRequest, PRInt32 *_retval) { return _to GetRequestType(aRequest, _retval); } \
  198.   NS_IMETHOD GetCurrentURI(nsIURI * *aCurrentURI) { return _to GetCurrentURI(aCurrentURI); } \
  199.   NS_IMETHOD LoadImageWithChannel(nsIChannel *aChannel, nsIStreamListener **_retval) { return _to LoadImageWithChannel(aChannel, _retval); } \
  200.   NS_IMETHOD ImageURIChanged(const nsAString & aNewURI) { return _to ImageURIChanged(aNewURI); } 
  201.  
  202. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  203. #define NS_FORWARD_SAFE_NSIIMAGELOADINGCONTENT(_to) \
  204.   NS_IMETHOD GetLoadingEnabled(PRBool *aLoadingEnabled) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLoadingEnabled(aLoadingEnabled); } \
  205.   NS_IMETHOD SetLoadingEnabled(PRBool aLoadingEnabled) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetLoadingEnabled(aLoadingEnabled); } \
  206.   NS_IMETHOD GetImageBlockingStatus(PRInt16 *aImageBlockingStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetImageBlockingStatus(aImageBlockingStatus); } \
  207.   NS_IMETHOD AddObserver(imgIDecoderObserver *aObserver) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddObserver(aObserver); } \
  208.   NS_IMETHOD RemoveObserver(imgIDecoderObserver *aObserver) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveObserver(aObserver); } \
  209.   NS_IMETHOD GetRequest(PRInt32 aRequestType, imgIRequest **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRequest(aRequestType, _retval); } \
  210.   NS_IMETHOD GetRequestType(imgIRequest *aRequest, PRInt32 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRequestType(aRequest, _retval); } \
  211.   NS_IMETHOD GetCurrentURI(nsIURI * *aCurrentURI) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCurrentURI(aCurrentURI); } \
  212.   NS_IMETHOD LoadImageWithChannel(nsIChannel *aChannel, nsIStreamListener **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->LoadImageWithChannel(aChannel, _retval); } \
  213.   NS_IMETHOD ImageURIChanged(const nsAString & aNewURI) { return !_to ? NS_ERROR_NULL_POINTER : _to->ImageURIChanged(aNewURI); } 
  214.  
  215. #if 0
  216. /* Use the code below as a template for the implementation class for this interface. */
  217.  
  218. /* Header file */
  219. class nsImageLoadingContent : public nsIImageLoadingContent
  220. {
  221. public:
  222.   NS_DECL_ISUPPORTS
  223.   NS_DECL_NSIIMAGELOADINGCONTENT
  224.  
  225.   nsImageLoadingContent();
  226.  
  227. private:
  228.   ~nsImageLoadingContent();
  229.  
  230. protected:
  231.   /* additional members */
  232. };
  233.  
  234. /* Implementation file */
  235. NS_IMPL_ISUPPORTS1(nsImageLoadingContent, nsIImageLoadingContent)
  236.  
  237. nsImageLoadingContent::nsImageLoadingContent()
  238. {
  239.   /* member initializers and constructor code */
  240. }
  241.  
  242. nsImageLoadingContent::~nsImageLoadingContent()
  243. {
  244.   /* destructor code */
  245. }
  246.  
  247. /* attribute boolean loadingEnabled; */
  248. NS_IMETHODIMP nsImageLoadingContent::GetLoadingEnabled(PRBool *aLoadingEnabled)
  249. {
  250.     return NS_ERROR_NOT_IMPLEMENTED;
  251. }
  252. NS_IMETHODIMP nsImageLoadingContent::SetLoadingEnabled(PRBool aLoadingEnabled)
  253. {
  254.     return NS_ERROR_NOT_IMPLEMENTED;
  255. }
  256.  
  257. /* readonly attribute short imageBlockingStatus; */
  258. NS_IMETHODIMP nsImageLoadingContent::GetImageBlockingStatus(PRInt16 *aImageBlockingStatus)
  259. {
  260.     return NS_ERROR_NOT_IMPLEMENTED;
  261. }
  262.  
  263. /* void addObserver (in imgIDecoderObserver aObserver); */
  264. NS_IMETHODIMP nsImageLoadingContent::AddObserver(imgIDecoderObserver *aObserver)
  265. {
  266.     return NS_ERROR_NOT_IMPLEMENTED;
  267. }
  268.  
  269. /* void removeObserver (in imgIDecoderObserver aObserver); */
  270. NS_IMETHODIMP nsImageLoadingContent::RemoveObserver(imgIDecoderObserver *aObserver)
  271. {
  272.     return NS_ERROR_NOT_IMPLEMENTED;
  273. }
  274.  
  275. /* imgIRequest getRequest (in long aRequestType); */
  276. NS_IMETHODIMP nsImageLoadingContent::GetRequest(PRInt32 aRequestType, imgIRequest **_retval)
  277. {
  278.     return NS_ERROR_NOT_IMPLEMENTED;
  279. }
  280.  
  281. /* long getRequestType (in imgIRequest aRequest); */
  282. NS_IMETHODIMP nsImageLoadingContent::GetRequestType(imgIRequest *aRequest, PRInt32 *_retval)
  283. {
  284.     return NS_ERROR_NOT_IMPLEMENTED;
  285. }
  286.  
  287. /* readonly attribute nsIURI currentURI; */
  288. NS_IMETHODIMP nsImageLoadingContent::GetCurrentURI(nsIURI * *aCurrentURI)
  289. {
  290.     return NS_ERROR_NOT_IMPLEMENTED;
  291. }
  292.  
  293. /* nsIStreamListener loadImageWithChannel (in nsIChannel aChannel); */
  294. NS_IMETHODIMP nsImageLoadingContent::LoadImageWithChannel(nsIChannel *aChannel, nsIStreamListener **_retval)
  295. {
  296.     return NS_ERROR_NOT_IMPLEMENTED;
  297. }
  298.  
  299. /* [noscript] void imageURIChanged (in AString aNewURI); */
  300. NS_IMETHODIMP nsImageLoadingContent::ImageURIChanged(const nsAString & aNewURI)
  301. {
  302.     return NS_ERROR_NOT_IMPLEMENTED;
  303. }
  304.  
  305. /* End of implementation class template. */
  306. #endif
  307.  
  308.  
  309. #endif /* __gen_nsIImageLoadingContent_h__ */
  310.